package DesignMode.Decorator;

/**
 * @author VX5
 * @Title: MJC
 * @ProjectName DataStructure
 * @Description: TODO
 * @date ${DAT}23:27
 */
public class Decorator extends Dringk{

    private Dringk obj;

    @Override
    public float cost() {
        //咖啡本身的价格
        return super.getPrice() + obj.cost();
    }

    public Decorator(Dringk obj) {
        this.obj = obj;
    }

    //重写描述
    @Override
    public String getDes(){
        //被装饰者的信息
        return super.des + " " + super.getPrice() + "&&" + obj.getDes();
    }
}
